<template>
  <div>
    <!--    <topBar></topBar>-->
    <nuxt/>
    <footerBar></footerBar>
  </div>
</template>
<script>
  import footerBar from '~/components/footerBar.vue'
  import topBar from '~/components/topBar.vue'

  export default {
    components: {
      topBar,
      footerBar
    },
    created () {
      if (process.client) {
        //require('external_library')
        //在页面加载时读取sessionStorage里的状态信息
        if (sessionStorage.getItem("store") ) {
          this.$store.replaceState(Object.assign({}, this.$store.state,JSON.parse(sessionStorage.getItem("store"))))
        }

        //在页面刷新时将vuex里的信息保存到sessionStorage里
        // eslint-disable-next-line nuxt/no-globals-in-created
        window.addEventListener("beforeunload",()=>{
          sessionStorage.setItem("store",JSON.stringify(this.$store.state))
        })
      }

    }
  }
</script>
<style>

  html {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    word-spacing: 1px;
    -ms-text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
    min-width: 1665px;
    background-color: #f1f1f1;
  }

  *,
  *:before,
  *:after {
    box-sizing: border-box;
    margin: 0;
  }

</style>
